package org.hbs.blog.code.dao.impl;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.apache.ibatis.session.SqlSessionFactory;
import org.hbs.blog.code.dao.IBlogTypeDao;
import org.hbs.blog.code.entity.BlogType;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

@Repository("blogTypeDao")
public class BlogTypeDao extends SqlSessionDaoSupport implements IBlogTypeDao {
	
	@Resource(name="sqlSessionFactory")
	private SqlSessionFactory sqlSessionFactory;
	
	@PostConstruct
	public void initializeSqlSessionFactory(){
		super.setSqlSessionFactory(sqlSessionFactory);
	}
	/*
	 * (non-Javadoc)
	 * @see org.hbs.blog.code.dao.IBlogTypeDao#insertBlogType(org.hbs.blog.code.entity.BlogType)
	 */
	public BlogType insertBlogType(BlogType blogType) {
		super.getSqlSession().insert("insertBlogType",blogType);
		return blogType;
	}
	/*
	 * (non-Javadoc)
	 * @see org.hbs.blog.code.dao.IBlogTypeDao#deleteBlogTypeByID(java.lang.String)
	 */
	public void deleteBlogTypeByID(String blogTypeID) {
		super.getSqlSession().delete("deleteBlogTypeByID", blogTypeID);
	}
	/*
	 * (non-Javadoc)
	 * @see org.hbs.blog.code.dao.IBlogTypeDao#updateBlogTypeByID(org.hbs.blog.code.entity.BlogType)
	 */
	public void updateBlogTypeByID(BlogType blogType) {
		super.getSqlSession().update("updateBlogTypeByID", blogType);
	}
}
